//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser General Public License
// along with this program.  If not, see http://www.gnu.org/licenses/.
// 

#ifndef OLSR_HELLOPIGGYBACKING_H_
#define OLSR_HELLOPIGGYBACKING_H_

#include "ManetRoutingCallable.h"

#include "OLSR.h"
#include "OLSR_ETX_state.h"
#include "OLSR_ETX_repositories.h"
#include "OLSR_ETX_parameter.h"

#include "applications/stemNetStimulus/KnowledgeRepository.h"
#include "applications/stemNetStimulus/TypeDefinitions.h"

class OLSR_HelloPiggybacking : public OLSR, public ManetRoutingCallable
{
private:
    friend class OLSR_HelloTimer;
    friend class OLSR_TcTimer;
    friend class OLSR_MidTimer;
    friend class OLSR_DupTupleTimer;
    friend class OLSR_LinkTupleTimer;
    friend class OLSR_Nb2hopTupleTimer;
    friend class OLSR_MprSelTupleTimer;
    friend class OLSR_TopologyTupleTimer;
    friend class OLSR_IfaceAssocTupleTimer;
    friend class OLSR_MsgTimer;
    friend class OLSR_Timer;

public:
    OLSR_HelloPiggybacking();
    virtual ~OLSR_HelloPiggybacking();

    void clearPiggyBackInfo(void);
    void setMyPiggyBackInfo(void *info_p);
    bool addNewPiggyBackInfo(void *info_p);

    ManetAddress getManetAddress() const {return getAddress();}

protected:
    virtual void initialize(int stage);

    virtual void send_hello();

    virtual bool process_hello(OLSR_msg&, const nsaddr_t &, const nsaddr_t &, const int &);

protected:
    std::list<node_state_info_t> piggyback_neighbourhood_info;
    node_state_info_t piggyback_my_info;

private:
    KnowledgeRepository *db;
};

#endif /* OLSR_HELLOPIGGYBACKING_H_ */
